1. /* scfctan.cpp by K.Tsuru */
  2. // function ID = 9114
  3. /*****************************************
  4. SComplex class
  5. It returns tan(z).
  6. Let z = x+iy,
  7. tan(z) = {sin(2*x)+i*sinh(2*y)}/{cos(2*x)+cosh(2*y)}
  8. 1 - exp(2*i*z)
  9. =i*-----------------
  10. 1 + exp(2*i*z)
  11. remake on Aug 14, 1995 (since version 2.30)
  12. *****************************************/
  13. #ifndef SN_H
  14. #include "sn.h"
  15. #endif
  16. SComplex Ctan(const SComplex& z)
  17. {
  18. if(z.IsZero()) return SComplex(0.0);
  19. #if 0 // 31.3 sec
  20. SDouble den, rr, ri;
  21. den = Cos(2*z.Real())+Cosh(2*z.Imag());
  22. den = 1/den;
  23. rr = Sin(2*z.Real()) * den;
  24. ri = Sinh(2*z.Imag()) * den;
  25. return SComplex(rr, ri);
  26. #else // 15.9 sec
  27. SComplex z2 = 2*MultI(z), ez2 = Cexp(z2), r;
  28. r = (1.0 - ez2)/(1.0 + ez2);
  29. return MultI(r);
  30. #endif
  31. }

scfctan.cpp : last modifiled at 2015/08/15 16:40:50(800 bytes)
created at 2017/10/06 15:21:28
The creation time of this html file is 2017/10/06 15:27:09 (Fri Oct 06 15:27:09 2017).